﻿import QtQuick 2.0
import QtQuick.Particles 2.13
import QtQuick.Window 2.13

Item {
    id: root
    width: Screen.width
    height: Screen.height

    Connections{
        target: widget
        onSendKeyPress: {
//            console.log("====",name)
//            trailsNormal.enabled = true
        }
        onSendStop: {
//            trailsNormal.enabled = false
        }
    }

    Rectangle{
        id: test
        anchors.fill: age
        border.color: "white"
        border.width: 1
        color: "transparent"
        opacity: 0
    }
/*
dsfdsfdsfsdfdsfdfdsfdsffdsdfsdfdsfsdfsdfsdfsdfsdfsdfdsfsdfsdfsdfsfds
技术喵打字动效1234567890212231211231231232131231231232134
*/

    ParticleSystem { id: sys1 }
    ImageParticle {
        system: sys1
        groups: ['rain']
        source: "qrc:/imamges/image/glowdot.png"
        color: "white" //Qt.rgba(101/255, 206/255, 255/255, 1)
        alpha: 0
        SequentialAnimation on color {
            loops: Animation.Infinite
//            ColorAnimation {
//                from: "cyan"
//                to: "magenta"
//                duration: 1000
//            }
//            ColorAnimation {
//                from: "magenta"
//                to: "cyan"
//                duration: 1000
//            }
        }
        colorVariation: 0
    }
    //! [0]
    Emitter {
        id: trailsNormal
        system: sys1
        group: 'rain'
//        enabled: false
        anchors.right: parent.right
        width: 600
        height: 2

        emitRate: 200
        lifeSpan: 4000

        velocity: PointDirection { x: 0; y: 200; xVariation: 2; yVariation: 10; }
        acceleration: PointDirection {x: 0; y: 200; xVariation: 2; yVariation: 10;}
//        velocityFromMovement: 10

        size: 30
        sizeVariation: 2
    }

    /*小房子*/
    Image {
        id: house
        anchors.right: parent.right
        anchors.rightMargin: 100
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 50
        source: "qrc:/imamges/image/house.png"
    }

    /*小房子*/
    Age{
        id: age
        anchors.fill: house
        lifeLeft: 0
        system: sys1
        groups: ['rain']
        shape: MaskShape{
            source: house.source
        }
    }


    /*瀑布烟花
    Emitter {
        id: trailsNormal
        system: sys1
//        enabled: false

        emitRate: 200
        lifeSpan: 3000

        y: root.height*1/5
        x: root.width/2

        velocity: PointDirection { x: 0; y: 10; xVariation: 30; yVariation: 0; }
        acceleration: PointDirection {x: 0; y: 50; xVariation: 10; yVariation: 10;}
        velocityFromMovement: 10

        size: 30
        sizeVariation: 2
    }*/
}
